package org.example.code.test2024.ten_mouth;

import java.util.*;

public class test1010 {
    public long waysToBuyPensPencils(int total, int cost1, int cost2) {
        long n = (total/cost1)+1 , res = n;
        for(long i=0;i<n;i++){
            res = res + (total- cost1 *i)/cost2;
        }
        return res;
    }

    public String largestGoodInteger(String num) {
        char[] charArray = num.toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<charArray.length;i++){
            if((i+3<charArray.length)&&charArray[i]==charArray[i+1]&&charArray[i+1]==charArray[i+2]){
                StringBuilder sb = new StringBuilder();
                sb.append(charArray[i]);
                sb.append(charArray[i+1]);
                sb.append(charArray[i+2]);
                list.add(sb.toString());
            }
        }
        if(list.size()==0){
            return "";
        }
        String strLine = list.get(0);
        for(String str:list){
            if(str.compareTo(strLine)>0){
                strLine=str;
            }
        }

        return strLine;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        boolean flag = true;
        while(flag){
            flag = false;
            for(int i=0;i<str.length();i++){
                if(i+1<str.length()&&str.charAt(i)==str.charAt(i+1)){
                    String str1 = str.substring(0,i);
                    String str2 = str.substring(i+2);
                    str = str1 + str2;
                    flag = true;
                }
            }
        }
        System.out.println(str);
    }
    public List<List<Integer>> findWinners(int[][] matches) {
        Map<Integer, Integer> answer2 = new HashMap<>();
        Set<Integer> answer = new TreeSet<>();

        for (int[] mt : matches) {
            answer.add(mt[0]);
            answer.add(mt[1]);
            answer2.put(mt[1], answer2.getOrDefault(mt[1], 0) + 1);
        }

        List<Integer> a1 = new ArrayList<>();
        List<Integer> a2 = new ArrayList<>();

        for (Integer a : answer) {
            if (answer2.getOrDefault(a, 0) == 1) {
                a2.add(a);
            } else if (answer2.getOrDefault(a, 0) == 0) {
                a1.add(a);
            }
        }

        List<List<Integer>> result = new ArrayList<>();
        result.add(a1);
        result.add(a2);
        return result;
    }


}
//class Solution {
//    public String largestGoodInteger(String num) {
//        String[] e = {"000","111","222","333","444","555","666","777","888","999"};
//        for(int i = 9; i >= 0; i--){
//            if(num.indexOf(e[i]) >= 0){return e[i];}
//        }
//        return "";
//    }
//}


